package ar.com.ford.it.fullEconomics.logic;

import java.util.Collection;
import java.util.LinkedList;
import ar.com.ford.it.fullEconomics.persistence.dao.WSLSecurityDao;
import ar.com.ford.it.fullEconomics.persistence.dto.Tms0008UsrprofVw;
import ar.com.ford.it.fullEconomics.struct.OptionCombo;
import ar.com.ford.it.webengine.settings.AppSettings;

public class UserLogic {

    public static Collection<OptionCombo> getUserActionTypes() {
        LinkedList<OptionCombo> list = new LinkedList<OptionCombo>();
        
        //XXX Ver como internacionalizar este combo
        list.add(new OptionCombo("Creation", "Creacion"));
        list.add(new OptionCombo("Proposal", "Propuesta"));
        list.add(new OptionCombo("Approval", "Aprobacion"));
        return list;
    }

    public boolean validateUser(Tms0008UsrprofVw tmsUser){
    	WSLSecurityDao dao = new WSLSecurityDao();
    	AppSettings app = AppSettings.getInstance();
    	tmsUser.setMs0008SystemCodeC(app.getAPP_NAME());
    	Collection<Tms0008UsrprofVw> users = dao.findUsr(tmsUser);
    	for(Tms0008UsrprofVw user : users){
    		if(user.getMs0008UserPassword().equalsIgnoreCase(tmsUser.getMs0008UserPassword()))
    			return true;
    	}
    	return false;
    	
    }
}
